<?php

class MemberSettingAction extends MemberBaseAction
{

    public function index()
    {
        $Categroy = D("Categroy");
        include COMMON_PATH . 'tree.php';
        $Tree = new Tree('');

        // 把查询条件传入查询方法
        $cat_value = $Categroy->order('fatherid asc')->select();
        foreach ($cat_value AS $id => $row) {
            $Tree->setNode($row['cid'], $row['fatherid'], $row['name']);
        }
        $_cat = $Tree->getChilds();

        foreach ($_cat as $key => $id) {
            $cat_value[$key]['cid'] = $id;
            $c_data = $Categroy->where('cid=' . $id)->find();
            $cat_value[$key]['name'] = $Tree->getLayer($id, '&nbsp;') . $Tree->getValue($id);
            $cat_value[$key]['fatherid'] = $c_data['fatherid'];
            $cat_value[$key]['orderid'] = $c_data['orderid'];
        }
        $this->assign('categoty', $cat_value);
        $this->display();
    }

}
?>

